package ricksguitars2;

import java.util.List;

/**
 * <p>Title: FindGuitarTester</p>
 * Description: CS 235 Lab #3 
 * This is the main class for a Guitar store inventory search program.
 * 
 * @author This code is from "Head First Object Oriented Design"
 * @date February 4th 2013
 */

public class FindGuitarTester {

	public static void main(String[] args) {
		// Set up Rick's guitar inventory
		Inventory inventory = new Inventory();
		initializeInventory(inventory);

		/*
		 * Get ready to search
		 */
		Guitar whatErinLikes = new Guitar("", 0, "fender", "Stratocastor",
				"electric", "Alder", "Alder");
		List whatIfound = inventory.search(whatErinLikes);

		/*
		 * If the search returns null, the item was not found.
		 */
		if (whatIfound != null) {
			System.out.println("Erin, you might like these: ");
			for (int i = 0; i < whatIfound.size(); i++) {
				Guitar g = (Guitar) (whatIfound.get(i));
				System.out.println(g.getBuilder() + " " + g.getModel() + " "
						+ g.getType() + " guitar:\n   " + g.getBackWood()
						+ " back and sides,\n   " + g.getTopWood()
						+ " top.\nYou can have it for only $" + g.getPrice()
						+ "!");
			}
		} else {
			System.out.println("Sorry, Erin, we have nothing for you.");
		}

	}

	private static void initializeInventory(Inventory inventory) {
		inventory.addGuitar("11277", 3999.95, "Collings", "CJ", "acoustic",
				"Indian Rosewood", "Sitka");
		inventory.addGuitar("V95693", 1499.95, "Fender", "Stratocastor",
				"electric", "Alder", "Alder");
		inventory.addGuitar("V9512", 1549.95, "Fender", "Stratocastor",
				"electric", "Alder", "Alder");
		inventory.addGuitar("122784", 5495.95, "Martin", "D-18", "acoustic",
				"Mahogany", "Adirondack");
		inventory.addGuitar("76531", 6295.95, "Martin", "OM-28", "acoustic",
				"Brazilian Rosewood", "Adriondack");
		inventory.addGuitar("70108276", 2295.95, "Gibson", "Les Paul",
				"electric", "Mahogany", "Maple");
		inventory.addGuitar("82765501", 1890.95, "Gibson", "SG '61 Reissue",
				"electric", "Mahogany", "Mahogany");
		inventory.addGuitar("77023", 6275.95, "Martin", "D-28", "acoustic",
				"Brazilian Rosewood", "Adirondack");
		inventory.addGuitar("1092", 12995.95, "Olson", "SJ", "acoustic",
				"Indian Rosewood", "Cedar");
		inventory.addGuitar("566-62", 8999.95, "Ryan", "Cathedral", "acoustic",
				"Cocobolo", "Cedar");
		inventory.addGuitar("6 29584", 2100.95, "PRS",
				"Dave Navarro Signature", "electric", "Mahogany", "Maple");
	}
}